/*
 * @Author: Starfish_DL
 * @Date: 2020-09-30 18:00:52
 * @LastEditors: Starfish_DL
 * @LastEditTime: 2020-09-30 19:40:45
 * @CurrentVersion: 1.0
 * @Description: 
 */

public class Person {
    private int age;
    private String name;
    private String school;
    private String major;

    //tag 作业第一题
    public void setAge(int a) {
        if (a>130 || a<0) {
            System.out.println("Parameter is wrong!");
        }
        else {
            this.age=a;
            System.out.println("Parameter age has set successfully!");
        }
        return;
    }

    public int getAge() {
        return this.age;
    }

    //tag 作业第二题
    public Person() {
        this.age=18;
        //this.name="YourName";
    }

    //tag 作业第三题
    public Person(String n, int a) {
        this.age=a;
        this.name=n;
    }

    public Person(String n, int a, String s) {
        this.age=a;
        this.name=n;
        this.school=s;
    }

    public Person(String n, int a, String s, String m) {
        this.age=a;
        this.name=n;
        this.school=s;
        this.major=m;
    }

    //tag 作业第三题
    public void setName(String i) {
            this.name=i;
            System.out.println("Parameter name has set successfully!");
        return;
    }

    public String getName() {
        return this.name; 
    }

    //tag 作业第三题
    public void printMessage() {
        System.out.println("该学生姓名："+this.name);
        System.out.println("该学生年龄："+this.age);
        System.out.println("该学生学校："+this.school);
        System.out.println("该学生专业："+this.major);
    }
}
